Skip to content

feat: add automatic HEAD request generation from GET request#2937

Closed
jean0t wants to merge 4 commits into
labstack:masterfrom
jean0t:pr_2895_automatic_head_request
Closed

feat: add automatic HEAD request generation from GET request#2937
jean0t wants to merge 4 commits into
labstack:masterfrom
jean0t:pr_2895_automatic_head_request

Conversation

@jean0t

@jean0t jean0t commented Apr 5, 2026

Copy link
Copy Markdown

the behavior is opt-out.

I created one flag in both Echo and Group struct (since they are related to the register of new routes) that is private and a function to explicit cancel this behavior.

Why: Mentioned in the issue #2895 I searched and saw that the default behavior in many frameworks is to automatically register a head request with GET, so I agree with the author of the issue that it should be included to guarantee an expected behavior from the programmer.

I added tests and only modified the high level functions, if the author think it is good and relevant enough to be merged, it will be good.

@aldas

aldas commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

@jean0t I think this would be better approach and more RFC comptible. See #2895 (comment)

@jean0t

jean0t commented Apr 5, 2026

Copy link
Copy Markdown
Author

I dont think it would be optimal to add a middleware if we can have it natively, also as I mentioned, it is the usual behavior in other frameworks.

@jean0t

jean0t commented Apr 6, 2026

Copy link
Copy Markdown
Author

you were right regarding the ResponseWriter, we need to have this to avoid some errors and make the request correct

vishr added a commit that referenced this pull request Jun 13, 2026
- Correct net/http interop claim: Echo handlers are not http.Handler;
  interop is via WrapHandler/WrapMiddleware
- Clarify binding ships with a pluggable validator (not built-in validation)
- ROADMAP: reference canonical auto-HEAD issue/PR (#2895/#2949) instead of
  the duplicate PRs (#2944/#2937) slated for closure

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vishr added a commit that referenced this pull request Jun 13, 2026
* docs: add liveness signals to README and a public ROADMAP

- Add dynamic latest-release and last-commit badges (can't go stale)
- Add positioning vs net/http and an "actively maintained" note
- Add ROADMAP.md with version policy (v5 current, v4 LTS to 2026-12-31)
  and surface it from the README

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: fix review findings in README/ROADMAP

- Correct net/http interop claim: Echo handlers are not http.Handler;
  interop is via WrapHandler/WrapMiddleware
- Clarify binding ships with a pluggable validator (not built-in validation)
- ROADMAP: reference canonical auto-HEAD issue/PR (#2895/#2949) instead of
  the duplicate PRs (#2944/#2937) slated for closure

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vishr

vishr commented Jun 13, 2026

Copy link
Copy Markdown
Member

Thank you for tackling this — automatic HEAD support has been one of our most-requested features (#2895). We're consolidating the work into #2949, which takes a router-level approach with an opt-in hook so users keep control. Closing this in favor of that PR, but your work helped shape the direction and it's genuinely appreciated. Please follow and review #2949. 🙏

@vishr vishr closed this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants